﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeChatV3Pay.Application;
using WeChatV3Pay.Core.Dtos;

namespace WeChatV3Pay.UnitTest.Grpc客户端测试
{
    public class 退款测试
    {
        private readonly WeChatPay.WeChatPayClient _client;

        public 退款测试(WeChatPay.WeChatPayClient client)
        {
            _client = client;
        }

        [Fact]
        public async Task 退款申请测试()
        {
            var request = new RefundsRequest()
            {
                Mchid = "1234325",
                Reason = "测试退款",
                NotifyUrl = "https://yyyyy.xxxxx.com",
                OutTradeNo = "123456",
                OutRefundNo = Guid.NewGuid().ToString().Replace("-", ""),
                Amount = new RefundAmountRequest()
                {
                    Currency = "CNY",
                    Total = 100,
                    Refund = 50,
                },
                PrivateKey = "123123123",
                SerialNo = "1234234",
            };
            var num = await _client.RefundsAsync(request);
            Assert.NotNull(num);
        }
    }
}
